/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package astroLib;

import astroLib.APC_Vect3D.*;

/**
 *
 * @author mehmetrg
 */
public class APC_Sun  {
    
static  double L;

//------------------------------------------------------------------------------
//
// MiniSun: Computes the Sun's RA and declination using a low precision 
//          analytical series
//
// Input:
//
//   T         Time in Julian centuries since J2000
//
// Output:
//
//   RA        Right Ascension of the Sun in [rad]
//   Dec       Declination of the Sun in [rad]
//
//------------------------------------------------------------------------------
static Equatorial MiniSun (double T)
{
  //
  // Constants
  //
  double eps =Math.toRadians( 23.43929111);
   double pi2=Math.PI*2;
    
  //
  // Variables
  //

  Polar  e_Sun;
  double M;

  // Mean anomaly and ecliptic longitude  
   M  = pi2 * APC_Math.Frac ( 0.993133 + 99.997361*T);
  L  = pi2 * APC_Math.Frac ( 0.7859453 + M/pi2 +  (6893.0*Math.sin(M)+72.0*Math.sin(2.0*M)+6191.2*T) / 1296.0e3);
  
  // Equatorial coordinates
  e_Sun=APC_Vect3D.calcPolarAngles (APC_Vect3D.AbProduct(APC_Vect3D.R_x(-eps),new Vec3D(new Polar(L,0.0))));
 // e_Sun = R_x(-eps) * Vec3D(Polar(L,0.0));
  
  Equatorial result=new Equatorial (e_Sun.phi,e_Sun.theta);
  return result;
}

}
